﻿using HrEFCore;
using HrIService;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HrService
{
	public class SSDService : ISSDService
	{
		private readonly MyDbContext myDbContext;

		public SSDService(MyDbContext myDbContext)
        {
			this.myDbContext = myDbContext;
		}

		public Task<int> SSDBGUpdate(SSD ssd)
		{
			var sd = myDbContext.SSD.Attach(ssd);
			sd.Property(e=>e.Salary).IsModified=true;
			return myDbContext.SaveChangesAsync();
		}

		public async Task<List<SSD>> SSDById(string StandardId)
		{
			return await myDbContext.SSD.Where(e=>e.StandardId == StandardId).ToListAsync();
		}

		public Task<List<SSD>> SSDSelectAsync()
		{
			return myDbContext.SSD.ToListAsync();
		}
	}
}
